package main

import (
	"bufio"
	"io"
	"os"
)

func file_put_content(filename, content string) error {
	f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0766)
	if err != nil {
		return err
	}
	defer f.Close()

	writer := bufio.NewWriter(f)
	_, err = writer.WriteString(content)
	if err != nil {
		return err
	}
	writer.Flush()
	return nil
}

func file_get_content(filename string) ([]byte, error) {
	f, err := os.Open(filename)
	if err != nil {
		return []byte{}, err
	}
	defer f.Close()

	data, err := io.ReadAll(f)
	if err != nil {
		return []byte{}, err
	}
	return data, nil
}
